classdef dotsDrawableTargets < dotsDrawable
    % @class dotsDrawableTargets
    % Draw one or multiple dots at once
    
    properties (SetObservable = true)
        % the x-coordinate for each dot (degrees visual angle, centered)
        x = 0;
        
        % the y-coordinate for each dot (degrees visual angle, centered)
        y = 0;
        
        % one size for all dots, or a size for each dot (pixels)
        dotSize = 1;
        
        % one color for all dots, or a color for each dot. (3xn or 4xn
        % array, where n may be 1 or the length of x and y.  3 rows must
        % specify RGB color components from 0-255.  A fourth row may
        % specify a transparency component, also 0-255)
        color = [255 255 255];
        
        % the shape for all dots (integer, where 0 means filled square, 1
        % means filled circle, and 2 means filled circle with high-quality
        % anti-aliasing)
        shape = 1;
    end
    
    methods
        function self = dotsDrawableTargets
            self = self@dotsDrawable;
            self.color = self.foregroundColor;
        end

        function draw(self)
            if length(self.x) > 0
                Screen('DrawDots', ...
                    self.windowNumber, ...
                    cat(1, self.x, -self.y)*self.pixelsPerDegree, ...
                    self.dotSize, ...
                    self.color, ...
                    (self.windowRect(3:4) - self.windowRect(1:2))./2, ...
                    self.shape);
            end
        end
    end
end